1. Field of the Invention
The present invention relates to an information processing apparatus equipped with multiple CPUs, and a control method thereof.
2. Description of the Related Art
Conventional devices with embedded software use a simple static memory allocation system. This system involves copying an entire program from a secondary storage device such as a hard disk or ROM to a main storage device such as a main memory (DRAM) before running the program on the main storage device. Recently, however, an operating system such as Windows™ or Linux™ with a virtual memory system has come to be used on embedded devices.
Virtual memory systems are generally implemented using paging technology, and operating systems such as Windows™ and Linux™ also use a paging system for their memory allocation system. The paging system, which will be described in detail later, has the following advantages compared to a static memory allocation system:    1. allows effective use of available memory, and    2. allows the use of more memory space than amounts of installed memory.
However, the paging system has the disadvantage of slow execution.
This is because the paging system loads only “parts of the program” that is frequently implemented in the main storage device while keeping “the entire program” stored in the secondary storage device such as a hard disk. With such a system, each time a CPU is going to execute the “other part of the program” not loaded in the main storage device, the CPU has to load “that other part of the program” which is to be implemented from the secondary storage device into the main storage device. Consequently, random-access reads from the secondary storage device are required when the program is executed.
The static memory allocation system and paging system will be described now.
The static memory allocation system loads all parts of a program together from the hard disk into physical memory. In many cases, architectures which use the static memory allocation system make no distinction between a virtual memory space and a physical memory space. When executing, for example, “part C of a program,” since the entire program is placed in the physical memory space, the CPU can implement the program promptly.
On the other hand, the paging system manages a virtual memory system by dividing a virtual memory space and a physical memory space into predetermined units of pages. This system is adopted by general purpose operating systems such as Windows™ and Linux™. Linux™, for example, uses a page size of 4 KB. In this way, the paging system puts only part (in units of pages) of a program instead of the entire executable program or data file in the physical memory and maps the physical memory to the virtual memory. If physical memory pages are not mapped to virtual memory pages accessed by the CPU, pages are read from the secondary storage device to the physical memory. This process is known as page-in. When a program not stored in the physical memory is executed, a page fault interrupt occurs. The page fault interrupt triggers a routine which searches the physical memory for free pages which are currently available in the physical memory. If free pages are found, the program is loaded from the secondary storage device onto the free pages. Then, after translating addresses between a part of the program in the virtual memory and part of the program in the physical memory, the system exits the page fault interrupt process and returns to normal processing to allow the CPU to execute the program in the virtual memory.
Among secondary storage devices, hard disks in particular are known for long random-access time. Thus, when programs are stored on a hard disk, the paging system has lower execution speed than the static memory allocation system.
Japanese Patent Laid-Open No. 2007-35066 describes a system which enables high-speed startup by creating a file system such as a RAM disk in a main storage device and copying a program from a secondary storage device to the RAM disk in advance during system initialization.
However, since it is not possible to delete or move a running program due to the characteristics of a virtual memory system, the RAM disk or a program copied to the RAM disk cannot be deleted during system operation. This is disadvantageous in that part of the main storage device is constantly used as the RAM disk, reducing the free space of the main storage device available to the system. Such a program can exceed 100 MB in size, in the case of, for example, a multifunction peripheral, and it is not desirable to make such a program reside in the main storage device from the viewpoint of space efficiency of the main storage device.